package paixu;

public class BubleSort {
    public static void main(String[] args) {
        int arr [] = new int[]{3,9,-1,10,-2,0};
        for (int i =0 ; i <arr.length;i++){
            boolean isFlag = true;
            for (int j = 0;j<arr.length-1-i;j++){
                if(arr[j]>arr[j+1]){
                    isFlag=false;
                    int temp = arr[j+1];
                    arr[j+1]=arr[j];
                    arr[j]=temp;
                }
            }
            if (isFlag){
                break;
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
